DECLARE SUB UpdateIniFiles
DECLARE SUB AddVJPD
DECLARE SUB AppendToIni (a$, b$, c$, d$)
SUB UpdateIniFiles STATIC
CursorSave% = ShowWaitCursor
IF GetListItem(SYM_CUSTOMCHECKSTATES$, SOUNDFILES) = VAL_CHKON$ THEN
IF InstallSpeaker% = YES% THEN
FixINFIniFiles SECT_SPKRDRVINF$, WinDir$, WinSysDir$
END IF
FixINFIniFiles SECT_SOUNDINF$, WinDir$, WinSysDir$
junk% = SendMessage (-1, WM_WININICHANGED, 0, INI_SOUNDS$)
END IF
IF GetListItem(SYM_CUSTOMCHECKSTATES$, DRIVERFILES) = VAL_CHKON$ THEN
CopyFile WinDir$+INI_SYSTEMINI, WinDir$+FILE_SYSTEMBAK$, cmoOverwrite, 0
CopyFile WinDir$+INI_WININI, WinDir$+FILE_WINBAK$, cmoOverwrite, 0
sz$ = WinDir$+FILE_WPSINI$
IF DoesFileExist (WinDir$+FILE_WPSINI$, femExists) <> 1 THEN
i% = FREEFILE
IF i% <> -1 THEN
OPEN sz$ FOR OUTPUT AS # i%
PRINT # i%, MSG_WPSINI_NOTE$
CLOSE # i%
END IF
END IF
sz$ = GetIniKeyString (INI_WININI$, INI_WINDOWS$, INI_NOTSELECT_TIMEOUT$)
IF VAL(sz$) < 45 THEN
CreateIniKeyValue INI_WININI$, INI_WINDOWS$, INI_NOTSELECT_TIMEOUT$, "45", cmoOverwrite
END IF
IF InstallPM% = YES% THEN
IF IniKeySpooler% = 1 THEN
CreateIniKeyValue INI_WININI$, INI_WINDOWS$, INI_SPOOLER$, INI_YES$, cmoOverwrite
END IF
bInstallPM% = TRUE
ELSE
bInstallPM% = FALSE
END IF
CreateIniKeyValue INI_WININI$, INI_WINDOWS$, INI_DOSPRINT$, LCASE$(INI_NO$), cmoOverwrite
FixPrinterIniFiles bInstallPM%
FixINFIniFiles SECT_DRIVERINF$, WinDir$, WinSysDir$
AddVJPD
AppendToIni INI_WININI$, INI_WINDOWS$, INI_RUN$, WinDir$+TestPageDir$+"\"+INI_TESTPAGE$
AppendToIni INI_WININI$, INI_WINDOWS$, INI_RUN$, WinSysDir$+INI_IOMON$
junk% = SendMessage (-1, WM_WININICHANGED, 0, INI_WINDOWS$)
sz$ = ""
END IF
IF CursorSave% <> 0 THEN
RestoreCursor(CursorSave%)
END IF
CursorSave% = 0
END SUB
SUB AddVJPD STATIC
DIM bDoDevice%, bNotFoundVpd%, bNotFoundVcomd%
szFile$ = WinDir$+INI_SYSTEMINI
szSect$ = INI_386ENH$
RemoveSymbol SYM_TEMPLIST$
szL$ = INI_LPT$
szA$ = INI_AUTOASSIGN$
FOR i% = 1 TO 3
szKey$ = szL$ + MID$(STR$(i%), 2, 1) + szA$
IF DoesIniKeyExist(szFile$, szSect$, szKey$) = 0 THEN
CreateSysIniKeyValue szFile$, szSect$, szKey$, "0", cmoVital
END IF
NEXT
bDoDevice = TRUE
bNotFoundVpd = TRUE
bNotFoundVcomd = TRUE
WHILE bDoDevice
sz$ = STRING$(48, 64)
i% = GetPrivateProfileString(szSect$, INI_DEVICE$,"@",sz$, 48, szFile$)
szL$ = LCASE$(sz$)
IF (i% = 1) AND (sz$ = "@") THEN
bDoDevice = FALSE
ELSEIF szL$ = "" THEN
AddListItem SYM_TEMPLIST$, sz$
RemoveIniKey szFile$, szSect$, INI_DEVICE$, cmoVital
ELSEIF szL$ = FILE_WPSLJVPD$ THEN
bNotFoundVpd = FALSE
IF bNotFoundVcomd = FALSE THEN
bDoDevice = FALSE
ELSE
AddListItem SYM_TEMPLIST$, sz$
RemoveIniKey szFile$, szSect$, INI_DEVICE$, cmoVital
END IF
ELSEIF szL$ = FILE_VCOMD$ THEN
bNotFoundVcomd = FALSE
IF bNotFoundVpd = FALSE THEN
bDoDevice = FALSE
ELSE
AddListItem SYM_TEMPLIST$, sz$
RemoveIniKey szFile$, szSect$, INI_DEVICE$, cmoVital
END IF
ELSE
IF (szL$ <> "vpd.386") AND (szL$ <> "vjpd.386") AND (szL$ <> "*vpd") AND (szL$ <> "vlexcomd.386") THEN
AddListItem SYM_TEMPLIST$, sz$
END IF
RemoveIniKey szFile$, szSect$, INI_DEVICE$, cmoVital
END IF
WEND
i% = GetListLength(SYM_TEMPLIST$)
FOR j% = i% TO 1 STEP -1
CreateSysIniKeyValue szFile$, szSect$, INI_DEVICE$, GetListItem (SYM_TEMPLIST$, j%), cmoVital
NEXT j%
IF bNotFoundVpd THEN
CreateSysIniKeyValue szFile$, szSect$, INI_DEVICE$, FILE_WPSLJVPD$, cmoVital
END IF
IF bNotFoundVcomd THEN
CreateSysIniKeyValue szFile$, szSect$, INI_DEVICE$, FILE_VCOMD$, cmoVital
END IF
szL$ = ""
szA$ = ""
szFile$ = ""
szSect$ = ""
RemoveSymbol SYM_TEMPLIST$
END SUB
SUB AppendToIni (szFile$, szSect$, szKey$, szVal$) STATIC
FRemoveValFromIniKey szFile$, szSect$, szKey$, szVal$
oldVal$ = GetIniKeyString (szFile$, szSect$, szKey$)
CreateIniKeyValue szFile$, szSect$, szKey$, oldVal$+" "+szVal$, cmoOverwrite
oldVal$ = ""
END SUB
